package com.lin.boot.controller;

import com.lin.boot.model.ZhihuUser;
import com.lin.boot.service.ZhihuUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("")
public class HelloController {

    @Autowired
    private ZhihuUserService zhihuUserService;

    @GetMapping(value = "/hello", produces = "application/json")
    public String hello() {
        return "hello";
    }

    @GetMapping("/zhihu/user/{id}")
    public ZhihuUser getZhihuUserById(@PathVariable("id") String id) throws Throwable {
        return zhihuUserService.getZhihuUserById(id);
    }
}
